added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2010 / CppWin7MultiTouch / CppWin7MultiTouch.cpp
blob91ab04f9add24ca5877401b322e6510f8741c46d
1 /****************************** Module Header ******************************\
2 * Module Name: CppWin7MultiTouch.cpp
3 * Project: CppWin7MultiTouch
4 * Copyright (c) Microsoft Corporation.
5 *
6 * Defines the entry point for the application.
7 *
8 * This source is subject to the Microsoft Public License.
9 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
10 * All other rights reserved.
12 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
13 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
15 \***************************************************************************/
17 #pragma once
18 #include "StdAfx.h"
19 #include "CppWin7MultiTouch.h"
21 MainWindow *g_pMainWindow;
23 int APIENTRY _tWinMain(HINSTANCE hInstance,
24 HINSTANCE hPrevInstance,
25 LPTSTR lpCmdLine,
26 int nCmdShow)
28 // Ignore the return value because we want to run the program even in the
29 // unlikely event that HeapSetInformation fails.
30 HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
32 // Initialize COM.
33 HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
34 if (FAILED(hr))
36 MessageBox(NULL, L"COM intialization failed! Cannot run the program!",
37 L"Critical Error", MB_OK | MB_ICONERROR);
38 return hr;
41 g_pMainWindow = new MainWindow(hInstance);
43 // Perform application initialization:
44 if (FAILED(g_pMainWindow->Initialize()))
46 return FALSE;
48 g_pMainWindow->RunMessageLoop();
50 CoUninitialize();
51 delete g_pMainWindow;
52 return 0;